import {
  queryDeleteReq,
  queryDownlineTaskReq,
  queryGetOverviewReq,
  queryPublishTaskReq,
  queryReRunTaskReq,
  queryStopReq,
} from './api'

export default {
  namespace: 'httpsApi',
  state: {},
  effects: {
    * queryGetOverview({ params, cb }, { call, put }) {
      const res = yield call(queryGetOverviewReq, params)
      if (cb) {
        cb(res)
      }
    },
    * queryReRunTask({ params, cb }, { call, put }) {
      const res = yield call(queryReRunTaskReq, params)
      if (cb) {
        cb(res)
      }
    },
    * queryDownlineTask({ params, cb }, { call, put }) {
      const res = yield call(queryDownlineTaskReq, params)
      if (cb) {
        cb(res)
      }
    },
    * queryDelete({ params, cb }, { call, put }) {
      const res = yield call(queryDeleteReq, params)
      if (cb) {
        cb(res)
      }
    },
    * queryPublishTask({ params, cb }, { call, put }) {
      const res = yield call(queryPublishTaskReq, params)
      if (cb) {
        cb(res)
      }
    },
    * queryStop({ params, cb }, { call, put }) {
      const res = yield call(queryStopReq, params)
      if (cb) {
        cb(res)
      }
    },
  },
  reducers: {},
}
